var code;

window.onload = createCode;

function createCode(){
	code = "" ;
	var codeLength = 4;
	var checkCode = document.getElementById("code");
	var random = new Array(0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
	for(var i = 0; i < codeLength; i++){
        var index = Math.floor(Math.random()*36);//取得随机数的索引（0~35）  
        code += random[index];//根据索引取得随机数加到code上  
    }  
    checkCode.value = code;

}
function validate(){  
    var inputCode = document.getElementById("codeinput").value.toUpperCase(); //取得输入的验证码并转化为大写        
    if(inputCode.length <= 0) { //若输入的验证码长度为0  
        alert("请输入验证码！"); //则弹出请输入验证码  
    }         
    else if(inputCode != code ) { //若输入的验证码与产生的验证码不一致时  
        alert("验证码输入错误！@_@"); //则弹出验证码输入错误  
        createCode();//刷新验证码  
        document.getElementById("codeinput").value = "";//清空文本框  
    }         
    else { //输入正确时  
//      alert("Right");
		location="bind.html";
    }             
}


function showgengduo(){
	var a1=document.getElementById("upper-chop-add2");
	if(a1.style.display=="block"){
		a1.style.display="none";
	}
	else{
		a1.style.display="block";
	}
	
	
}
function showduoxuan(){
	var a1=document.getElementById("upper-chop2");
	a1.style.display="block";
	
	var a2=document.getElementById("upper-chop");
	a2.style.display="none";
}
function showtianjia($a){
		var $b=parseInt($a);
		var t =document.getElementById("EN"+$b);
		var t2=document.getElementById("upper-add"+$b);	
		t2.style.display="block";
}
function showyincang($b){
	var $c=parseInt($b);
	var a=document.getElementById("guanbi"+$c);
	var d=document.getElementById("upper-add"+$c);	
	d.style.display="none";
}
function showxianshen(){
	var b1=document.getElementById("upper-chop");
	b1.style.display="block";
	var b2=document.getElementById("upper-chop2");
	b2.style.display="none";
}

function showquanxuan(){
var a=document.getElementById("checkall");
var itEle=document.getElementsByClassName("check");
if(a.checked="true"){
for(var i=0;i<itEle.length;i++){
//var e=itEle[i];
//e.checked=!e.checked;
//if(checked=!e.checked){
//	checked==e.checked;
//	}else{
//		checked==!e.checked;
//	}
itEle[i].checked="true";
}
}
if(a.checked="false"){
	itEle[i].checked="false";
	
}

}

